package windbell.domain.risk.events;

import edu.fudan.mylang.pf.event.EntityEventsManager;
import java.util.Collection;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import windbell.domain.risk.RiskCheck;
import windbell.domain.risk.RiskCheckTemplate;
import windbell.domain.risk.events.RiskCheckEventsListener;

@Service("windbell.domain.risk.events.RiskCheckEventsManager")
public class RiskCheckEventsManager extends EntityEventsManager<RiskCheck> {
  @Autowired(required = false)
  private Collection<RiskCheckEventsListener> listeners = com.google.common.collect.Lists.newArrayList();;
  
  protected Collection<RiskCheckEventsListener> getListeners() {
    return listeners;
  }
  
  public void fireCreateItemsFromTemplate(final RiskCheck entity, final RiskCheckTemplate template) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((RiskCheckEventsListener)listener).createItemsFromTemplate(entity,template);
    }
    
  }
  
  public void firePublish(final RiskCheck entity, final Date date) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((RiskCheckEventsListener)listener).publish(entity,date);
    }
    
  }
  
  public void fire$itemFinished(final RiskCheck entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((RiskCheckEventsListener)listener).$itemFinished(entity);
    }
    
  }
}
